from pyprocessmacro.process import Process


class RegressionDetails:
    def __init__(self, names, coef, se, T, pval, r2, adj_r2, CI_2_5, CI_97_5):
        self.names = names
        self.coef = coef
        self.se = se
        self.T = T
        self.pval = pval
        self.r2 = r2
        self.adj_r2 = adj_r2
        self.CI_2_5 = CI_2_5
        self.CI_97_5 = CI_97_5


class RegressionModel:
    def __init__(self, f, p, details: []):
        self.f = f
        self.p = p
        self.details = details


class Model1Result:
    def __init__(self, r_y2x: RegressionModel, r_y2xm: RegressionModel, r_y2xm2: RegressionModel, x, y, m, covar):
        self.r_y2x = r_y2x
        self.r_y2xm = r_y2xm
        self.r_y2xm2 = r_y2xm2
        self.x = x
        self.y = y
        self.m = m
        self.covar = covar


class Model4Result:
    def __init__(self, mediation_table, r_y2x, r_y2xm, r_m2x, x, y, m, covar):
        self.mediation_table = mediation_table
        self.r_y2x = r_y2x
        self.r_y2xm = r_y2xm
        self.r_m2x = r_m2x
        self.x = x
        self.y = y
        self.m = m
        self.covar = covar


class Model4Mediation:
    def __init__(self, path, coef, se, pval, CI_2_5, CI_97_5, sig):
        self.path = path
        self.coef = coef
        self.se = se
        self.pval = pval
        self.CI_2_5 = CI_2_5
        self.CI_97_5 = CI_97_5
        self.sig = sig


class Model6Result:
    def __init__(self, mediation_table, m1_x, m2_x_m1, y_x, y_x_m1_m2, x, y, m1, m2, covar):
        self.mediation_table = mediation_table
        self.m1_x = m1_x
        self.m2_x_m1 = m2_x_m1
        self.y_x = y_x
        self.y_x_m1_m2 = y_x_m1_m2
        self.x = x
        self.y = y
        self.m1 = m1
        self.m2 = m2
        self.covar = covar


class Model7Result:
    def __init__(self, y2xm, m2xw, x, y, m, w, covar, mediation_table=None):
        self.mediation_table = mediation_table
        self.y2xm = y2xm
        self.m2xw = m2xw
        self.x = x
        self.y = y
        self.m = m
        self.w = w
        self.covar = covar


class Model8Result:
    def __init__(self, y2xwm, m2xw, x, y, m, w, covar, p: Process = None):
        self.p = p
        self.y2xwm = y2xwm
        self.m2xw = m2xw
        self.x = x
        self.y = y
        self.m = m
        self.w = w
        self.covar = covar


class Model14Result:
    def __init__(self, y2xwm, m2xw, x, y, m, w, covar, p: Process = None):
        self.p = p
        self.y2xwm = y2xwm
        self.m2xw = m2xw
        self.x = x
        self.y = y
        self.m = m
        self.w = w
        self.covar = covar


class Model15Result:
    def __init__(self, m2xw, y2xwm, x, y, m, w, covar, p: Process = None):
        self.p = p
        self.m2xw = m2xw
        self.y2xwm = y2xwm
        self.x = x
        self.y = y
        self.m = m
        self.w = w
        self.covar = covar


class CFAResultFi:
    def __init__(self, cmin: str = "", df_value: str = "", cmin_df: str = "", nfi: str = "", rfi: str = "",
                 ifi: str = "",
                 tli: str = "", cfi: str = "", gfi: str = "", rmsea: str = ""):
        self.cmin = cmin
        self.df_value = df_value
        self.cmin_df = cmin_df
        self.nfi = nfi
        self.rfi = rfi
        self.ifi = ifi
        self.tli = tli
        self.cfi = cfi
        self.gfi = gfi
        self.rmsea = rmsea


class CFAResultFactorDetails:
    def __init__(self, name, est, se, z, std_all, p):
        self.name = name
        self.est = est
        self.se = se
        self.z = z
        self.std_all = std_all
        self.p = p


class CFAResultFactor:
    def __init__(self, details: [CFAResultFactorDetails] = None, ave=None, ave_k_sq=None, cr=None):
        self.details = details
        self.ave = ave
        self.ave_k_sq = ave_k_sq
        self.cr = cr


class CFAResult:
    def __init__(self, fi_value: CFAResultFi = None, item_dict: dict[str, CFAResultFactor] = None,
                 factor_dict: dict[str, CFAResultFactor] = None):
        self.fi_value = fi_value
        self.item_dict = item_dict
        self.factor_dict = factor_dict


class SEMResultFactorDetails:
    def __init__(self, est, se, z, std_all, p, from_name: str = "", to_name: str = ""):
        self.from_name = from_name
        self.to_name = to_name
        self.est = est
        self.se = se
        self.z = z
        self.std_all = std_all
        self.p = p


class SEMResultFactor:
    def __init__(self, details: [SEMResultFactorDetails] = None):
        self.details = details


class SEMResult:
    def __init__(self, fi_value: CFAResultFi = None, item_dict: dict[str, SEMResultFactorDetails] = None):
        self.fi_value = fi_value
        self.item_dict = item_dict


class SEMRelationConfig:
    def __init__(self, from_name, to_name):
        self.from_name = from_name
        self.to_name = to_name
